package com.ai_daily.aitiantian;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class KeywordRepository {
    private static KeywordRepository instance = null;
    private final String SLEEP_WORD_KEY = "sleep_word_key";
    private final String SENSITIVE_WORDS_KEY = "sensitive_Words_key";
    private final HashMap<String, List<String>> keywordsMap = new HashMap<>();

    private KeywordRepository() {

    }

    public static synchronized KeywordRepository getInstance() {
        if (instance == null) {
            instance = new KeywordRepository();
        }
        return instance;
    }

    public void setSensitiveWords(List<String> words) {
        keywordsMap.put(SENSITIVE_WORDS_KEY, words);
    }

    public void setSleepWords(List<String> words) {
        keywordsMap.put(SLEEP_WORD_KEY, words);
    }

    public List<String> getSensitiveWords() {
//        List<String> sensitiveWords = new ArrayList<>();
//        sensitiveWords.add("敏感词");
//        sensitiveWords.add("测试");
//        keywordsMap.put(SENSITIVE_WORDS_KEY,sensitiveWords);
        return keywordsMap.get(SENSITIVE_WORDS_KEY);
    }

    public List<String> getSleepWords() {
        return keywordsMap.get(SLEEP_WORD_KEY);
    }
}
